package com.xsomnus.java_basic.proxy.test.impl;

import com.xsomnus.java_basic.proxy.test.IUserService;
import com.xsomnus.java_basic.proxy.test.User;

import java.util.HashMap;
import java.util.Map;

/**
 * @author @xsomnus666_xiawenye★
 * @since 2019/7/19 0019 11:48
 * - 才需学也,学需静也/非淡泊无以明志，非宁静无以致远
 */
public class UserServiceImpl implements IUserService {

    private static final Map<String, User> userMap = new HashMap<>();

    @Override
    public User save(User user) {
        System.out.println("保存用户 " + user);
        userMap.put(user.getUserId(), user);
        return user;
    }

    @Override
    public User getByUserId(String userId) {
        System.out.println("查找用户: userId = " + userId);
        return userMap.get(userId);
    }
}
